home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.05 May 91 / Multifile source ƒ / mfldef.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-12-28  |  1.4 KB  |  83 lines  |  [TEXT/MPS ]

  1. /*
  2. **    File mfldef.c
  3. **    Source file for custom LDEF for MultiFile dialog.
  4. **
  5. **    Copyright © Eric Schlegel 1987, 1988
  6. */
  7.  
  8.  
  9. #include    <types.h>
  10. #include    <quickdraw.h>
  11. #include    <lists.h>
  12. #include    "mfpriv.h"
  13.  
  14. pascal void Debugger()
  15.     extern 0xA9FF;
  16.  
  17. pascal void mfldef(lmsg, lselect, lrect, lcell, loffset, ldatalen, lhandle)
  18. short        lmsg;
  19. Boolean        lselect;
  20. Rect        *lrect;
  21. Cell        lcell;
  22. short        loffset;
  23. short        ldatalen;
  24. ListHandle    lhandle;
  25. {
  26.     void    doinit();
  27.     void    dodraw();
  28.     void    dohilite();
  29.     
  30.     switch (lmsg) {
  31.         case lInitMsg:
  32.             doinit(lhandle);
  33.             break;
  34.         case lDrawMsg:
  35.             /* only column 0 needs to be drawn    */
  36.             if (!lcell.h)
  37.                 dodraw(lselect, lrect, loffset, lhandle);
  38.             break;
  39.         case lHiliteMsg:
  40.             /* ditto as above    */
  41.             if (!lcell.h)
  42.                 dohilite(lrect);
  43.             break;
  44.     }
  45. }
  46.  
  47. void doinit(lhandle)
  48. ListHandle    lhandle;
  49. {
  50.     FontInfo    fntinfo;
  51.     
  52.     GetFontInfo(&fntinfo);
  53.     SetPt(&((*lhandle)->indent), 4, fntinfo.ascent);
  54. }
  55.  
  56. void dodraw(lselect, lrect, loffset, lhandle)
  57. Boolean        lselect;
  58. Rect        *lrect;
  59. short        loffset;
  60. ListHandle    lhandle;
  61. {
  62.     MFCELL        *data;
  63.     short        strlen;
  64.     
  65.     HLock((*lhandle)->cells);
  66.     
  67.     data = *((*lhandle)->cells) + loffset;
  68.     
  69.     PenNormal();
  70.     MoveTo(lrect->left + (*lhandle)->indent.h, lrect->top + (*lhandle)->indent.v);
  71.     DrawText(data->fname.text, 0, data->fname.length);
  72.     
  73.     HUnlock((*lhandle)->cells);
  74.     
  75.     if (lselect)
  76.         InvertRect(lrect);
  77. }
  78.  
  79. void dohilite(lrect)
  80. Rect    *lrect;
  81. {
  82.     InvertRect(lrect);
  83. }